/*   1:    */ package com.rinsi.app.azsb.sltzs;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.service.CoreSimpleService;
/*   4:    */ import com.rinsi.util.AssertUtil;
/*   5:    */ import com.rinsi.util.FormaterUtil;
/*   6:    */ import com.rinsi.util.MapUtil;
/*   7:    */ import java.util.Date;
/*   8:    */ import java.util.Map;
/*   9:    */ import org.mybatis.spring.SqlSessionTemplate;
/*  10:    */ import org.springframework.stereotype.Service;
/*  11:    */ 
/*  12:    */ @Service("sltzsTxService")
/*  13:    */ public class SltzsService
/*  14:    */   extends CoreSimpleService
/*  15:    */ {
/*  16:    */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/*  17:    */   {
/*  18: 17 */     Map<String, Object> params = getParams(model);
/*  19:    */     
/*  20: 19 */     Map<String, Object> config = getConfig(model);
/*  21:    */     try
/*  22:    */     {
/*  23: 23 */       Map<String, Object> data = (Map)getSqlSessionTemplate().selectOne(namespace(config) + ".list", params);
/*  24:    */       
/*  25: 25 */       Integer allDatas = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectOrganNo", params);
/*  26:    */       
/*  27: 27 */       Integer allSl = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectSLZT", params);
/*  28:    */       
/*  29: 29 */       Integer qyxz = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectQyxz", params);
/*  30:    */       
/*  31: 31 */       Integer isQysq = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".isQysq", params);
/*  32:    */       
/*  33: 33 */       Integer szs = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".getSzs", params);
/*  34:    */       
/*  35: 35 */       allDatas = Integer.valueOf(allDatas.intValue() + 1);
/*  36:    */       
/*  37: 37 */       allSl = Integer.valueOf(allSl.intValue() + 1);
/*  38:    */       
/*  39: 39 */       String slbhTemp = "";
/*  40:    */       
/*  41: 41 */       String temp = "";
/*  42: 43 */       if (allDatas.intValue() < 10)
/*  43:    */       {
/*  44: 45 */         temp = "000" + allDatas;
/*  45:    */         
/*  46: 47 */         slbhTemp = "000" + allSl;
/*  47:    */       }
/*  48: 49 */       else if ((10 <= allDatas.intValue()) && (allDatas.intValue() < 100))
/*  49:    */       {
/*  50: 51 */         temp = "00" + allDatas;
/*  51:    */         
/*  52: 53 */         slbhTemp = "00" + allSl;
/*  53:    */       }
/*  54: 55 */       else if ((100 <= allDatas.intValue()) && (allDatas.intValue() < 999))
/*  55:    */       {
/*  56: 57 */         temp = "0" + allDatas;
/*  57:    */         
/*  58: 59 */         slbhTemp = "0" + allSl;
/*  59:    */       }
/*  60:    */       else
/*  61:    */       {
/*  62: 63 */         slbhTemp = String.valueOf(allSl);
/*  63:    */         
/*  64: 65 */         temp = String.valueOf(allDatas);
/*  65:    */       }
/*  66: 68 */       StringBuffer TZS_SLBH = new StringBuffer();
/*  67: 70 */       if (qyxz.intValue() == 6) {
/*  68: 72 */         TZS_SLBH.append("X");
/*  69: 74 */       } else if (qyxz.intValue() == 5) {
/*  70: 76 */         TZS_SLBH.append("D");
/*  71:    */       } else {
/*  72: 80 */         TZS_SLBH.append("G");
/*  73:    */       }
/*  74: 84 */       if (isQysq.intValue() == 5) {
/*  75: 86 */         TZS_SLBH.append("Q");
/*  76:    */       }
/*  77: 90 */       switch (szs.intValue())
/*  78:    */       {
/*  79:    */       case 1: 
/*  80: 94 */         TZS_SLBH.append("A");
/*  81:    */         
/*  82: 96 */         break;
/*  83:    */       case 2: 
/*  84:100 */         TZS_SLBH.append("B");
/*  85:    */         
/*  86:102 */         break;
/*  87:    */       case 3: 
/*  88:106 */         TZS_SLBH.append("C");
/*  89:    */         
/*  90:108 */         break;
/*  91:    */       case 4: 
/*  92:112 */         TZS_SLBH.append("F");
/*  93:    */         
/*  94:114 */         break;
/*  95:    */       case 5: 
/*  96:118 */         TZS_SLBH.append("H");
/*  97:    */         
/*  98:120 */         break;
/*  99:    */       case 6: 
/* 100:124 */         TZS_SLBH.append("J");
/* 101:    */         
/* 102:126 */         break;
/* 103:    */       case 7: 
/* 104:130 */         TZS_SLBH.append("K");
/* 105:    */         
/* 106:132 */         break;
/* 107:    */       case 8: 
/* 108:136 */         TZS_SLBH.append("D");
/* 109:    */         
/* 110:138 */         break;
/* 111:    */       case 9: 
/* 112:142 */         TZS_SLBH.append("E");
/* 113:    */         
/* 114:144 */         break;
/* 115:    */       case 10: 
/* 116:148 */         TZS_SLBH.append("L");
/* 117:    */         
/* 118:150 */         break;
/* 119:    */       case 11: 
/* 120:154 */         TZS_SLBH.append("M");
/* 121:    */       }
/* 122:160 */       TZS_SLBH.append("[");
/* 123:    */       
/* 124:162 */       TZS_SLBH.append(FormaterUtil.formatDateValue(new Date(), "yyyy"));
/* 125:    */       
/* 126:164 */       TZS_SLBH.append("]");
/* 127:    */       
/* 128:166 */       TZS_SLBH.append(slbhTemp);
/* 129:168 */       switch (isQysq.intValue())
/* 130:    */       {
/* 131:    */       case 6: 
/* 132:172 */         TZS_SLBH.append("b");
/* 133:    */         
/* 134:174 */         break;
/* 135:    */       case 4: 
/* 136:178 */         TZS_SLBH.append("b");
/* 137:    */         
/* 138:180 */         break;
/* 139:    */       case 2: 
/* 140:184 */         TZS_SLBH.append("y");
/* 141:    */         
/* 142:186 */         break;
/* 143:    */       case 3: 
/* 144:190 */         TZS_SLBH.append("y");
/* 145:    */       }
/* 146:196 */       rMap.put("UNAME", getSqlSessionTemplate().selectOne(namespace(config) + ".getUserName", params));
/* 147:    */       
/* 148:198 */       data.put("TZS_BH", "【" + FormaterUtil.formatDateValue(new Date(), "yyyy") + " 】 " + temp);
/* 149:    */       
/* 150:200 */       data.put("TZS_SLBH", TZS_SLBH);
/* 151:    */       
/* 152:202 */       data.put("TZS_SLRQ", FormaterUtil.formatDateValue(new Date(), "yyyy-MM-dd HH:mm:ss"));
/* 153:    */       
/* 154:204 */       rMap.put("data", data);
/* 155:    */       
/* 156:206 */       rMap.putAll(getParams(model));
/* 157:    */     }
/* 158:    */     catch (Exception ex)
/* 159:    */     {
/* 160:210 */       ex.printStackTrace();
/* 161:    */       
/* 162:212 */       rMap.put("success", Boolean.valueOf(false));
/* 163:214 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 164:216 */         rMap.put("message", ex.getMessage());
/* 165:    */       } else {
/* 166:220 */         rMap.put("message", "保存数据出错！请稍后重试，或联系系统管理员！");
/* 167:    */       }
/* 168:    */     }
/* 169:    */   }
/* 170:    */   
/* 171:    */   public Map<String, Object> save(Map<String, Object> model)
/* 172:    */   {
/* 173:230 */     Map<String, Object> params = getParams(model);
/* 174:    */     
/* 175:232 */     Map<String, Object> config = getConfig(model);
/* 176:    */     
/* 177:234 */     Map<String, Object> rMap = getRMap();
/* 178:    */     try
/* 179:    */     {
/* 180:238 */       if (!AssertUtil.isStringNotEmpty(params.get(config.get("module.idCol"))))
/* 181:    */       {
/* 182:240 */         String key = getKey(config);
/* 183:    */         
/* 184:242 */         params.put(MapUtil.getString(config, "module.idCol"), key);
/* 185:    */         
/* 186:244 */         Integer allDatas = (Integer)getSqlSessionTemplate().selectOne(namespace(config) + ".selectOrganNo", params);
/* 187:    */         
/* 188:246 */         allDatas = Integer.valueOf(allDatas.intValue() + 1);
/* 189:    */         
/* 190:248 */         String temp = "";
/* 191:250 */         if (allDatas.intValue() < 10) {
/* 192:252 */           temp = "00" + allDatas;
/* 193:254 */         } else if ((10 <= allDatas.intValue()) && (allDatas.intValue() < 100)) {
/* 194:256 */           temp = "0" + allDatas;
/* 195:    */         } else {
/* 196:260 */           temp = String.valueOf(allDatas);
/* 197:    */         }
/* 198:264 */         params.put("TZS_BH", "【" + FormaterUtil.formatDateValue(new Date(), "yyyy") + " 】 " + temp);
/* 199:    */         
/* 200:266 */         getSqlSessionTemplate().insert(namespace(config) + ".insert", params);
/* 201:    */       }
/* 202:    */       else
/* 203:    */       {
/* 204:271 */         beforeUpdate(model);
/* 205:    */         
/* 206:273 */         getSqlSessionTemplate().update(namespace(config) + ".update", params);
/* 207:    */       }
/* 208:276 */       rMap.put("data", getSqlSessionTemplate().selectOne(namespace(config) + ".get", params));
/* 209:    */     }
/* 210:    */     catch (Exception ex)
/* 211:    */     {
/* 212:280 */       ex.printStackTrace();
/* 213:    */       
/* 214:282 */       rMap.put("success", Boolean.valueOf(false));
/* 215:284 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 216:286 */         rMap.put("message", ex.getMessage());
/* 217:    */       } else {
/* 218:290 */         rMap.put("message", "保存数据出错！请稍后重试，或联系系统管理员！");
/* 219:    */       }
/* 220:    */     }
/* 221:294 */     return rMap;
/* 222:    */   }
/* 223:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.app.azsb.sltzs.SltzsService
 * JD-Core Version:    0.7.0.1
 */